#pragma once

#include "Types.h"
#include "ImageInfo.h"

namespace Vortex { namespace Wrapper { namespace Direct3D {

	ref class Direct3DDevice9;
	ref class Direct3DTexture9;
	ref class Direct3DSurface9;
	ref class D3DXBuffer;
	ref class D3DXConstantTable;

	public ref struct D3DX abstract sealed {

		static const UINT Default = D3DX_DEFAULT;
		static const UINT Default_NonPow2 = D3DX_DEFAULT_NONPOW2;
		static const UINT MAX_SHADER_TEXT_LENGTH = 16384;
		static const UINT MAX_SHADER_FUNCNAME_LENGTH = 128;
		static const UINT MAX_SHADER_PROFILE_LENGTH = 64;


		///<summary>Creates texture from file loaded in memory</summary>
		static HResult CreateTextureFromFileInMemoryEx(
		  Direct3DDevice9^ device,
		  array<byte>^ srcData,
		  UINT width,
		  UINT height,
		  UINT mipLevels,
		  D3DUsage usage,
		  D3DFormat format,
		  D3DPool pool,
		  D3DXImageFilter filter,
		  D3DXImageFilter mipFilter,
		  D3DCOLOR colorKey,
		  //[Out] ImageInfo% pSrcInfo,
		  [Out] Direct3DTexture9^% result
		);

		///<summary>Compiles shader from source code</summary>
		static HResult CompileShader(
			String^ shaderSource,
			ref class D3DXShaderInclude^ include,
			String^ functionName,
			String^ profile,
			D3DXCompileShaderFlags flags,
			[Out] D3DXBuffer^% shaderCodeBuffer,
			[Out] String^% errors,
			[Out] D3DXConstantTable^% constantTable
		);

		///<summary>Load data onto surface from pointer in memory</summary>
		static HResult LoadSurfaceFromMemory(
			Direct3DSurface9^ destSurface,
			System::Drawing::Rectangle destRect,
			LPCVOID  pSrcMemory,
			D3DFormat srcFormat,
			UINT srcPitch,
			System::Drawing::Rectangle srcRect,
			DWORD filter,
			DWORD colorKey);

		static HResult LoadSurfaceFromSurface(
			Direct3DSurface9^ destSurface,
			System::Drawing::Rectangle destRect,
			Direct3DSurface9^ srcSurface,
			System::Drawing::Rectangle srcRect,
			DWORD filter,
			D3DCOLOR colorKey );
	};

}}}